import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: 86183
 * Date: 2024-04-18
 * Time: 18:16
 */
public class Demo1 {
    public static void main(String[] args) throws IOException {
        InputStream inputStream  = new FileInputStream
                ("E:\\img\\图书馆\\微信图片_20240324210435.jpg") ;
        while(true){
            byte[] bytes = new byte[1024];//先准备好一个空的字节数组

            int n = inputStream.read(bytes);
            //方法执行完毕后,把读到的数据放到字节数组中
            //返回值表示成功读取到的字节数
            //如果返回值为-1,则表示未成功读到任何数据
            System.out.println("n = "+n);
            if(n==-1){
                break;
            }
            for (int i = 0; i <n ; i++) {
                System.out.printf("0x%x ",bytes[i]);
            }
            System.out.println();
        }

    }
}
